<div class="pb15 job_for_you">	
	<div class="title_offer pb15 pt10">Recommended <span class="helv_neue_thin">Offers</span></div>
	
		<div>	
		
			<?php 
				// $flag = 'left';
				if(!empty($offers)){ 
					foreach($offers as $val){
						// if($flag = 'left'){
			?>
		
			<div class="offer_list pb15 fl">
				<div class="y_ball fl"><img src="<?php echo ApplicationConfig::getImageUrl('OFFER-THUMBNAIL', array('file_name'=>$val->offer_image_thumb)); ?>" height="60" width="60"></div>
				<div class="fl ml10 offer_info">
					<div class="fl lh20">
						<span class="helv_black fnt33 fl"><?php echo $val->offer_value_percentage; ?>%</span>
						<div class="yx fl"></div>
						<div class="cl"></div>
						<span class="helv_light fnt11">VOUCHER</span>
						<div style="line-height:12px;" class="helv_light"><a class="gr" href="#">View Details</a></div>
					</div>
					<div class="fr">
						
						<?php
							if (ApplicationSessions::run()->read('userID')!=""){
								$offerApp = OfferSelection::model()->getModel("OFFER-APPLICANT-ID", array('offerID'=>$val->offerID,'userID'=>ApplicationSessions::run()->read('userID'),'vendorID'=>$val->vendorID));
								// echo "<pre>"; print_r($offerApp); exit;
								if (empty($offerApp))
								{ 	
									echo "<div id='applyrecofferdiv$val->offerID'>";
										echo CHtml::ajaxButton(
											'',
											ApplicationConfig::getURL("","site","offerSelection",array('offerID'=>$val->offerID,'userID'=>ApplicationSessions::run()->read('userID'),'vendorID'=>$val->vendorID)),
											array('update'=>'#applyrecofferdiv'.$val->offerID),
											array('id'=>'apply'.$val->offerID,'class'=>'add')
										);
									echo "</div>";
								}
								else 
								{
									echo "<div id='applyrecofferdiv$val->offerID' style='width: 45px;padding-left:5px;font-family: none;color: green;'> Added </div>";
								}
							}
							else 
							{
								echo "<input type='button' class='add' onclick='checkLogin()'>";
							}	
						?>
						
						<div class="cl pt10"></div>
						<div class="fr"><a class="facebook" href="#"></a><a class="twitter" href="#"></a><a class="email" href="#"></a></div>
					</div>	
					<div class="cl"></div>				
				</div>
		   </div>
		   
		<?php } ?> <div class="cl"></div> <?php } else { echo "No recommended offers found."; }?>
		
	<div class="mt5">see more</div>

	</div>
</div>

<script>

function checkLogin()
{
	$('#aaa').trigger('click');
	$('#LoginForm_username').val("");
	$('#LoginForm_username').focus();
}

</script>